

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Aspect Based Sentiment Analysis (ABSA) Solution &mdash; NLP Architect by Intel® AI Lab 0.5.2 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
        <script type="text/javascript" src="_static/language_data.js"></script>
        <script type="text/javascript" src="_static/install.js"></script>
        <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/nlp_arch_theme.css" type="text/css" />
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono" type="text/css" />
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:100,900" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Set Expansion Solution" href="term_set_expansion.html" />
    <link rel="prev" title="Compression of Google Neural Machine Translation Model" href="sparse_gnmt.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html">
          

          
            
            <img src="_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul>
<li class="toctree-l1"><a class="reference internal" href="quick_start.html">Quick start</a></li>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="publications.html">Publications</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorials.html">Jupyter Tutorials</a></li>
<li class="toctree-l1"><a class="reference internal" href="model_zoo.html">Model Zoo</a></li>
</ul>
<p class="caption"><span class="caption-text">NLP/NLU Models</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="tagging/sequence_tagging.html">Sequence Tagging</a></li>
<li class="toctree-l1"><a class="reference internal" href="sentiment.html">Sentiment Analysis</a></li>
<li class="toctree-l1"><a class="reference internal" href="bist_parser.html">Dependency Parsing</a></li>
<li class="toctree-l1"><a class="reference internal" href="intent.html">Intent Extraction</a></li>
<li class="toctree-l1"><a class="reference internal" href="lm.html">Language Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="information_extraction.html">Information Extraction</a></li>
<li class="toctree-l1"><a class="reference internal" href="transformers.html">Transformers</a></li>
<li class="toctree-l1"><a class="reference internal" href="archived/additional.html">Additional Models</a></li>
</ul>
<p class="caption"><span class="caption-text">Optimized Models</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="quantized_bert.html">Quantized BERT</a></li>
<li class="toctree-l1"><a class="reference internal" href="transformers_distillation.html">Transformers Distillation</a></li>
<li class="toctree-l1"><a class="reference internal" href="sparse_gnmt.html">Sparse Neural Machine Translation</a></li>
</ul>
<p class="caption"><span class="caption-text">Solutions</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Aspect Based Sentiment Analysis</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#overview">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="#solution-overview">Solution overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="#solution-execution">Solution execution</a></li>
<li class="toctree-l2"><a class="reference internal" href="#flow">Flow</a></li>
<li class="toctree-l2"><a class="reference internal" href="#workflow-and-ui">Workflow and UI</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="term_set_expansion.html">Set Expansion</a></li>
<li class="toctree-l1"><a class="reference internal" href="trend_analysis.html">Trend Analysis</a></li>
</ul>
<p class="caption"><span class="caption-text">For Developers</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="generated_api/nlp_architect_api_index.html">nlp_architect API</a></li>
<li class="toctree-l1"><a class="reference internal" href="developer_guide.html">Developer Guide</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">NLP Architect by Intel® AI Lab</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>Aspect Based Sentiment Analysis (ABSA) Solution</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="aspect-based-sentiment-analysis-absa-solution">
<h1>Aspect Based Sentiment Analysis (ABSA) Solution<a class="headerlink" href="#aspect-based-sentiment-analysis-absa-solution" title="Permalink to this headline">¶</a></h1>
<div class="section" id="overview">
<h2>Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h2>
<p>Aspect Based Sentiment Analysis is the task of co-extracting opinion terms and aspect terms
(opinion targets) and the relations between them in a given corpus.</p>
</div>
<div class="section" id="solution-overview">
<h2>Solution overview<a class="headerlink" href="#solution-overview" title="Permalink to this headline">¶</a></h2>
<p>The solution flow includes three stages: first, it generates domain-specific aspect and
opinion lexicons based on an unlabeled dataset; second, it enables the user to view and edit
those lexicons; and finally, it enables the user to select an unlabeled target dataset from the
same domain, classify it, and generate an aspect-based sentiment report.</p>
<p>For lexicon extraction, the solution calls the training step of NLP Architect’s ABSA
training, whereas for sentiment classification, the solution calls NLP Architect’s ABSA inference.
For more details see <a class="reference internal" href="absa.html"><span class="doc">ABSA</span></a>.</p>
</div>
<div class="section" id="solution-execution">
<h2>Solution execution<a class="headerlink" href="#solution-execution" title="Permalink to this headline">¶</a></h2>
<p>All three stages of the solution are end-to-end executed by a dedicated UI.
An example for running the UI is available at <code class="docutils literal notranslate"><span class="pre">examples/absa/solution/absa_solution.py</span></code>.</p>
<p>Install solution extra packages:</p>
<div class="code python highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">r</span> <span class="n">solutions</span><span class="o">/</span><span class="n">absa_solution</span><span class="o">/</span><span class="n">requirements</span><span class="o">.</span><span class="n">txt</span>
</pre></div>
</div>
<div class="code bash highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="n">examples</span><span class="o">/</span><span class="n">absa</span><span class="o">/</span><span class="n">solution</span><span class="o">/</span><span class="n">absa_solution</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
</div>
<div class="section" id="flow">
<h2>Flow<a class="headerlink" href="#flow" title="Permalink to this headline">¶</a></h2>
<img alt="_images/absa_solution_workflow.png" src="_images/absa_solution_workflow.png" />
</div>
<div class="section" id="workflow-and-ui">
<h2>Workflow and UI<a class="headerlink" href="#workflow-and-ui" title="Permalink to this headline">¶</a></h2>
<img alt="_images/absa_solution_ui_3.png" src="_images/absa_solution_ui_3.png" />
<p>Figure 1: The solution’s UI.</p>
<p>Following is a description of the 3 steps of the solution operation:</p>
<p>Step 1: The first step of the flow is to select an input dataset for lexicon extraction, performed by
clicking the ‘Extract lexicons’ button shown in Figure 1. Once a dataset* is selected, the system
performs the lexicon extraction process. Note that, this step can be skipped, in case the user
already has aspect and opinion lexicons. In order to load pre-trained aspect and opinion lexicons
select ‘Edit Lexicons’ -&gt; ‘Load’ (figure 1).
For demonstration purposes, we provide pre-trained lexicons that are located at <code class="docutils literal notranslate"><span class="pre">examples/aspects.csv</span></code> and <code class="docutils literal notranslate"><span class="pre">examples/opinion.csv</span></code>
We also provide, a sample dataset** for lexicon extraction, at <code class="docutils literal notranslate"><span class="pre">datasets/absa/tripadvisor_co_uk-travel_restaurant_reviews_sample_2000_train.csv</span></code>.</p>
<p>Step 2: The user can choose to edit an aspect lexicon or an opinion lexicon that were generated in
the previous step by selecting the ‘Aspect Lexicon’ or ‘it Opinion Lexicon’ tab (see figure 1).
As shown in Figure 1, in which the ‘Aspect Lexicon’ has been selected, the ‘Term’ column displays
the aspect terms while the ‘Alias1-3’ columns display aspect terms that have the same semantic
meaning. Upon selecting a specific aspect, the ‘Examples’
view on the right-hand side, displays text snippets from the input dataset that include this term
(highlighted in blue). the user can delete (by unchecking the term’s checkbox), add or modify the
lexicon items.
The opinion lexicon editor (not shown) functions similarly to the aspect lexicon editor except that
it includes a ‘Polarity’ column and a ‘Score’ column. Both the polarity and the score can be edited
by the user.</p>
<p>Step 3: A target dataset* and its classification are performed by clicking the ‘Classify’ button in
Figure 1. Once the dataset is selected the system starts the sentiment classification process and
generates visualization of the sentiment analysis results under the ‘Analysis’ tab (figure 2).
For demonstration purposes we provide a sample classification dataset**, located at <code class="docutils literal notranslate"><span class="pre">datasets/absa/tripadvisor_co_uk-travel_restaurant_reviews_sample_2000_test.csv</span></code>.</p>
<p>* The format of the input dataset to steps 1 and 3 is a single raw text file with documents
separated by newlines or a single csv file containing one doc per line or a directory containing one raw
text file per document or a directory that includes parsed text files.</p>
<p>** Restaurants reviews from tripadvisor.co.uk under the <a class="reference external" href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share-Alike 3.0 License</a> (Copyright 2018 Wikimedia Foundation).</p>
<img alt="_images/absa_solution_ui_4.png" src="_images/absa_solution_ui_4.png" />
<p>Figure 2. Results visualization: Top: bar-chart that displays the amount of positive and
negative sentiment towards each aspect.
Bottom: textual table that displays (upon clicking a specific aspect on the bar chart) sentences
that include positive/negative sentiment towards that specific aspect. Aspect terms are colored in
blue and opinion terms are colored in green/red:</p>
</div>
</div>


           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>